package controller

import (
	"context"
	"lot_admin_api/api"
	"lot_admin_api/internal/model"
	"lot_admin_api/internal/service"
)

var Billing = cBilling{}

type cBilling struct{}

// AddBilling  新增收费方案
func (h *cBilling) AddBilling(ctx context.Context, req *api.AddBillingReq) (res *model.BillingIdRes, err error) {
	id, _ := service.Billing().AddBilling(ctx, req)
	res = &model.BillingIdRes{
		Id: id,
	}
	return res, err
}

// EditBilling  编辑收费方案
func (h *cBilling) EditBilling(ctx context.Context, req *api.EditBillingReq) (res *model.BillingIdRes, err error) {
	id, _ := service.Billing().EditBilling(ctx, req)
	res = &model.BillingIdRes{
		Id: id,
	}
	return res, err
}

// DeleteBilling  删除收费方案
func (h *cBilling) DeleteBilling(ctx context.Context, req *api.DeleteBillingReq) (res *model.BillingIdRes, err error) {
	id, _ := service.Billing().DeleteBilling(ctx, req)
	res = &model.BillingIdRes{
		Id: id,
	}
	return res, err
}

// BillingInfo  通过id获取收费方案详情
func (h *cBilling) BillingInfo(ctx context.Context, req *api.BillingInfoReq) (res *model.BillingDbInfoRes, err error) {
	res, _ = service.Billing().SearchBilling(ctx, req.Id)
	return res, err
}

// BillingList  获取收费方案列表
func (h *cBilling) BillingList(ctx context.Context, req *api.BillingListReq) (res *model.BillingListRes, err error) {
	res, _ = service.Billing().BillingList(ctx, req)
	return res, err
}
